<!DOCTYPE html>
<html>
<head>
	<title>Change templates</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlxcombo.css"/>
	<script src="../../../codebase/dhtmlxcombo.js"></script>
	<style>
		div.combo_info {
			color: gray;
			font-size: 11px;
			padding-bottom: 5px;
			padding-left: 2px;
			font-family: Tahoma;
		}
		span.template_text {
			font-size: 12px;
			font-family: monospace;
		}
	</style>
	<script>
		var myCombo;
		function doOnLoad() {
			// from script
			myCombo = new dhtmlXCombo("combo_zone", null, null, "image");
			myCombo.setImagePath("../common/flags/");
			myCombo.enableFilteringMode(true);
			myCombo.setTemplate({input: "#capital#", option: "#capital# - #country#"});
			myCombo.addOption("1", {country: "Finland", capital: "Helsinki"}, null, "finland.png", true);
			myCombo.addOption("2", {country: "Germany", capital: "Berlin"}, null, "germany.png");
			myCombo.addOption("3", {country: "Great Britain", capital: "London"}, null, "britain.png");
			myCombo.addOption("4", {country: "Hungary", capital: "Budapest"}, null, "hungary.png");
		}
		function setTemplate(index) {
			var t = [
				{input: "#capital#", option: "#capital# - #country#"},
				{input: "#country#", option: "#country# - #capital#"}
			];
			myCombo.setTemplate(t[index]);
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h3>From script</h3>
	<div id="combo_zone" style="width:230px;"></div>
	<br>
	<div>
		<div><input type="button" value="set" onclick="setTemplate(0);"> <span class="template_text">{input: "#capital#", option: "#capital# - #country#"}</span></div>
		<div><input type="button" value="set" onclick="setTemplate(1);"> <span class="template_text">{input: "#country#", option: "#country# - #capital#"}</span></div>
	</div>
</body>
</html>
